<?php

class Tophotels_ru extends Grabber_Abstract
{
	
	public function _init()
	{

		
		
	}
	
	
	
}
/*

$oUsers   = new Users( $db );
$oLink    = new Links( $db );
$oComments= new Comments( $db );
$oProxy   = new Proxy();
$oBrowser = new Browser();
$oFile    = new File( 'tophotels.ru' );
echo 'good'; exit;
$data = $oFile->get( 'hotels' );
if( !$data )
{
    $url = 'http://www.tophotels.ru/main/top100/100/';
    $result = $oBrowser->get( $url );
    $result = iconv('windows-1251', 'utf-8', $result);
    $result = preg_replace('/\n/iU', '', $result);

    $matched = array();
    //http://www.tophotels.ru/main/hotel/al5055/
    preg_match_all('!class="parity\d+".*title="(.*)"\ target="_blank"\ href="(.*)"!iU', $result, $matched);

    //print_r($matched);

    $data = array();
    foreach( $matched[1] as $key => $title )
    {
	$data[$matched[2][$key]] = $title;
	echo '<a href="'. $matched[2][$key] .'">'. $title .'</a><br />';
    }
    
    $oFile->save( 'hotels', $data );
}

$data = (array)$data;

$html = '';
$title_link = '';
foreach( $data as $url => $title )
{
    $html = $oBrowser->get( $url );
    $title_link = $title;
    if( $html )
    {
	unset( $data[$url] );
	break;
    }
}

$html = iconv('windows-1251', 'utf-8', $html);

$_used_users = array();
$matched = array();
$link_id = 0;

preg_match_all('!class="review-text-premium">(.*)<!iU', $html, $matched);
if( !empty( $matched[1] ) && !empty( $matched[1][0] ) )
{
    $_user_id = $oUsers->getRandomUser( $_used_users );
    $_used_users[] = $_user_id;
    
//    $link_id = $oLink->addLink($_user_id, 1, $title_link, $matched[1][0]);
    $link_id = 1;
}
//echo $html;
$matched = array();
preg_match_all('!class="review-text">(\n?.+)\n?<d!iU', $html, $matched);

print_r( $matched ); exit();

if( !empty( $matched[1] ) && !empty( $matched[1][0] ) )
{
    $_user_id = $oUsers->getRandomUser( $_used_users );
    $_used_users[] = $_user_id;
    
    $link_id = $oComments->addComment($_user_id, $link_id, $title_link, $matched[1][0]);
}

print_r( $matched[1][0] );





//$_used_users = array();
//
//for($i=0; $i < 4; $i++)
//{
//    $_user_id = $oUsers->getRandomUser($_used_users);
//    $_used_users[] = $_user_id;
//}
//
//$oLink->addLink($_user_id, 1, 'Бім бім', 'hello content');
//$oUsers->updateKarma($_user_id, 'review');
//echo 'user_id: '. $_user_id . ';';
//
//print_r($_used_users); exit();
 
  
 */